// 定义首页需要的接口函数
import { request } from '@/utils/request'

/**
 * 获取首页头部分类数据
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const findAllCategory = () => {
    return request('/home/category/head','GET')
}

/**
 * 获取单个顶级分类信息
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getTopCategory = (id) => {
    return request('/category','GET',{ id })
}

/**
 * 获取二级分类筛选条件数据
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getSubCategoryFilter = (id) => {
    return request('/category/sub/filter','GET',{ id })
}

/**
 * 获取分类下的商品（带筛选条件）
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getSubCategoryGoods = (params) => {
    return request('/category/goods/temporary','POST', params)
}